<template>
  <div>{{name}}</div>
</template>

<script>
import { reactive, ref, toRefs, getCurrentInstance } from "vue";
import utils from '@/utils/utils'
export default {
  name: "",
  // 定义模板
  components: {},
  //在创建组件之前执行
  setup(props, context) {
    const state = reactive({
      name: "你好",
    });
    const num = ref(0);
    //方法一 
    const { proxy } = getCurrentInstance();
    console.log(proxy.publicMethod,111111)
    console.log(utils,222222)
    utils.bb()

    //方法二
    // const instance = getCurrentInstance()
    // console.log(instance.appContext.config.globalProperties.publicMethod)
    // console.log(context)

    return {
      ...toRefs(state),
      num,
    };
  },
};
</script>
<style scoped lang ='less'>
</style>